<?php

namespace app\validate;

use think\Validate;

class UserValidate extends Validate
{

    protected $rule = [
        'name'  =>  'require|length:5,100|unique:sys_user',
        'password' =>  'require|length:6,100',
        'status' =>  'require|in:0,1',
    ];

    protected $message = [
        'name.require'  =>  '用户名不能为空',
        'name.length'  =>  '用户名长度必须在6到100之间',
        'name.unique' =>  '用户已存在',
        'password.require'  =>  '密码不能为空',
        'password.length'  =>  '密码长度必须在6到100之间',
       'status.require'  =>  '状态不能为空',
       'status.in'  =>  '状态只能为0或1',
    ];

    protected $scene = [
        'modify'  =>  ['password','status'],
    ];
}